home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 526-550 / disk_541 / steal / src / showgad.c < prev    next >
C/C++ Source or Header  |  1992-05-06  |  1KB  |  69 lines

  1. /****************************************************************************
  2.  
  3.                 ShowGad.c
  4.  
  5.     This file should be linked together with a compiled version
  6.     of Stolen.c, or whatever it's name may be. That file must
  7.     contain the following:
  8.      - A struct Gadget gad1.
  9.  
  10.                     Rick van Rein, October 2, 1990
  11.  
  12. ****************************************************************************/
  13.  
  14.  
  15.  
  16. #include <functions.h>
  17.  
  18. #include <Intuition/Intuition.h>
  19.  
  20.  
  21. void *IntuitionBase;
  22.  
  23. extern struct Gadget gad1;
  24.  
  25.  
  26.  
  27. /***** The main routine of the showing mechanism: */
  28.  
  29.  
  30. struct NewWindow nwin =
  31.  {
  32.    0, 0, 0, 0,
  33.    -1, -1,
  34.    CLOSEWINDOW,
  35.    SMART_REFRESH | WINDOWDEPTH | WINDOWCLOSE | WINDOWDRAG,
  36.    NULL,
  37.    NULL,
  38.    (UBYTE *) "ShowGad",
  39.    NULL,
  40.    NULL,
  41.    -1, -1, -1, -1,
  42.    WBENCHSCREEN
  43.  };
  44.  
  45.  
  46. main ()
  47.  {
  48.    struct Window *win;
  49.  
  50.    IntuitionBase = OpenLibrary ("intuition.library", 0L);    /* This call will succeed always */
  51.    nwin.FirstGadget = &gad1;
  52.    nwin.Width = 10 + gad1.Width;
  53.    if (nwin.Width < 100)
  54.       nwin.Width = 100;
  55.    nwin.Height = 20 + gad1.Height;
  56.    gad1.LeftEdge = 5;
  57.    gad1.TopEdge = 15;
  58.    gad1.NextGadget = NULL;
  59.    if (win = OpenWindow (&nwin))
  60.     {
  61.       WaitPort (win->UserPort);        /* Wait for CLOSEWINDOW message over IDCMP */
  62.       ReplyMsg (GetMsg (win->UserPort));
  63.       CloseWindow (win);
  64.     }
  65.    else
  66.       puts ("\tShowGad: Can't open Window for the Gadget");
  67.    CloseLibrary (IntuitionBase);
  68.  }
  69.